package com.gxg.repository;

import com.gxg.entities.Ptitle;
import com.gxg.entities.Video;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import javax.transaction.Transactional;
import java.util.List;

public interface VideoRepository extends JpaRepository<Video, Long> {

    List<Video> findAll();
    List<Video> findByChildImgWebUrl(String childWebUrl);
    List<Video> findByVideoClass(String videoClass);
    List<Video> findByVideoWebUrl(String webUrl);
    List<Video> findByTeacherId(String teacherId);
    Video save(Video video);
    @Transactional
    void deleteByVideoLocalUrl(String localUrl);

    Page<Video> findByTeacherIdAndParentTitle(String teacherId, String parentTitle, Pageable pageable);
    int countByTeacherIdAndParentTitle(String teacherId,String parentTitle);
    int countByTeacherId(String teacherId);
}
